package org.jeecg.modules.wangyue.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.wangyue.constant.CommonConstant;
import org.jeecg.modules.wangyue.constant.ConfigParamConstant;
import org.jeecg.modules.wangyue.constant.DelFlagConstant;
import org.jeecg.modules.wangyue.entity.Configuration;
import org.jeecg.modules.wangyue.entity.UserRoleInfo;
import org.jeecg.modules.wangyue.mapper.ConfigurationMapper;
import org.jeecg.modules.wangyue.mapper.UserRoleInfoMapper;
import org.jeecg.modules.wangyue.model.res.ResUserRoleInfoModel;
import org.jeecg.modules.wangyue.service.IUserRoleInfoService;
import org.jeecg.modules.wangyue.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: 角色信息表
 * @Author: jeecg-boot
 * @Date:   2023-06-30
 * @Version: V1.0
 */
@Service
public class UserRoleInfoServiceImpl extends ServiceImpl<UserRoleInfoMapper, UserRoleInfo> implements IUserRoleInfoService {

    @Autowired
    private UserRoleInfoMapper userRoleInfoMapper;


    @Override
    public IPage<ResUserRoleInfoModel> getJsUserRoleInfo(Page page, String keywords, String userId, String cityCode, String log, String lat,
                                                         String distance, String serviceNum, String sex, String yearMax, String yearMin,
                                                         String serviceTypeCode, String serviceItemsCode, String sortType) {
        String dateStr = DateUtil.getTimeStrToMillis("yyyy-MM-dd HH:mm:ss", CommonConstant.onlineJsCheckTimeDifference);
        return userRoleInfoMapper.queryJsUserRoleInfo(page, keywords, userId, cityCode, log, lat, distance,
                serviceNum, sex, yearMax, yearMin, serviceTypeCode, serviceItemsCode, sortType, dateStr);
    }

    @Override
    public String computeDistanceFromJs(String log, String lat, String jsUserId, String jsUserType) {
        return userRoleInfoMapper.computeDistanceFromJs(log, lat, jsUserId, jsUserType);
    }

    @Override
    public IPage<UserRoleInfo> getUserRoleInfoByPage(Page page, String userType, String keywords) {
        return userRoleInfoMapper.queryUserRoleInfoByPage(page, userType, keywords);
    }

    @Override
    public IPage<UserRoleInfo> getJsRoleInfoByPage(Page page, String userType, String keywords, String isRoleAuth) {
        return userRoleInfoMapper.queryJsRoleInfoByPage(page, userType, keywords, isRoleAuth);
    }

    @Override
    public List<UserRoleInfo> getUserRoleInfoByList(String userType, List<String> idList, String keywords) {
        return userRoleInfoMapper.queryUserRoleInfoByList(userType, idList, keywords);
    }

    @Override
    public List<UserRoleInfo> getJsRoleInfoByList(String userType, List<String> idList, String keywords, String isRoleAuth) {
        return userRoleInfoMapper.queryJsRoleInfoByList(userType, idList, keywords, isRoleAuth);
    }


}
